package com.zhiqihang.result;

import com.zhiqihang.order.OrderCode;
import lombok.Getter;

/**
 * @ClassName JsonResult
 * @Description Violet
 * @Author 86183
 * @Date 2024/7/13 16:50
 * @Version 1.0
 */
@Getter
public class JsonResult {
    private Integer code;
    private String msg;
    private Object data;

    private JsonResult(){}
    public JsonResult(ResultCode resultCode, Object data) {
        this.code = resultCode.code();
        this.msg = resultCode.msg();
        this.data = data;
    }


    public static JsonResult ok(ResultCode resultCode,Object data){
        return new JsonResult(resultCode,data);
    }
    public static JsonResult ok(Object data){
        return new JsonResult(OrderCode.ORDER_FOUND,data);
    }
    public static JsonResult ok(){
        return new JsonResult(OrderCode.ORDER_FOUND,null);
    }

}
